#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main(int argc,char*argv[])
{
    int lInt = 66;
    int gInt = 16;
    pid_t pid;
    pid=fork();
    if(pid < 0)
    {
        printf("error");
        return 1;
    }
    if(pid > 0)
    {
        printf("In parent process,pid = %d\n",getpid());
        printf("gInt = %d,lInt = %d in %d process\n",gInt,lInt,(int)getpid());
    }
    else
    {//pid == 0  child 
        gInt +=2;
        lInt +=3;
        printf("In child process,pid = %d\n",getpid());
        printf("gInt = %d,lInt = %d in %d process\n",gInt,lInt,(int)getpid());
    }
    printf("I will exit,pid = %d\n",getpid());
    return 0;
}